package com.wuxiaofan.member.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.member.entity.MemberCollectSpu;
import com.wuxiaofan.member.entity.custom.MemberCollectSpuCustom;
import com.wuxiaofan.member.mapper.MemberCollectSpuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.member.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class MemberCollectSpuService {
    @Autowired
    private MemberCollectSpuMapper umsMemberCollectSpuMapper;
    @Resource
    private Idgenerator idgenerator;
    public MemberCollectSpu findById(String id){
        return umsMemberCollectSpuMapper.selectById(id);
    }

    public MemberCollectSpuCustom findCountByMap(Map paraMap){
        return umsMemberCollectSpuMapper.findCountByMap(paraMap);
    }

    public MemberCollectSpuCustom findGroupByMap(Map paraMap){
        return umsMemberCollectSpuMapper.findGroupByMap(paraMap);
    }

    public List<MemberCollectSpuCustom> findByMap(Map paraMap){
        return umsMemberCollectSpuMapper.findByMap(paraMap);
    }

    public Page<MemberCollectSpuCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(umsMemberCollectSpuMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        umsMemberCollectSpuMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        umsMemberCollectSpuMapper.deleteById(id);
    }

    public MemberCollectSpu save(MemberCollectSpu umsMemberCollectSpu){
        umsMemberCollectSpu.setId(idgenerator.getId());
        umsMemberCollectSpuMapper.insert(umsMemberCollectSpu);
        return umsMemberCollectSpu;
    }

}
